//封装本地储存数据及读取数据；
const LOCAL_TOKEN_KEY = "token_key";
/** 本地存储key键值枚举 */
// export enum LocalStorageKeys {
//   /** 访问令牌 */
//   accessToken = "access_token",
//   /** 刷新令牌 */
//   refreshToken = "refresh_token",
// }

/**
 * 存储数据
 * @param token token数据
 * @returns
 */
export const setToken = (token: string, key = LOCAL_TOKEN_KEY) =>
  localStorage.setItem(key, token);

/**
 * 获取本地存储数据
 * @returns
 */
export const getToken = (key = LOCAL_TOKEN_KEY) => localStorage.getItem(key);

/**
 * 移除本地存储数据
 * @returns
 */
export const removeToken = (key = LOCAL_TOKEN_KEY) =>
  localStorage.removeItem(key);
